Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RedboxState now includes citations #1118

Draft
wants to merge 5 commits into
base: feature/redbox-697-wikipedia-tool
Choose a base branch
from

Conversation

saisakul
Copy link
Contributor

@saisakul saisakul commented Oct 22, 2024

Context

We need citations to help users understand where the LLM use the information to answer users' queries.

Changes proposed in this pull request

  • Update retrieval response prompt so that it returns citations. The response now returns 1) markdown_answer and 2) citations.
  • Add StructureOutput to handle citations.
  • Add citations to RedboxState

Example response:

{
            "markdown_answer": "Hello Kitty is a fictional character from Japan.",
            "citations": [
                {
                    "text": "Hello Kitty is a fictional character from Japan.",
                    "sources": [
                        {
                            "source": "https://en.wikipedia.org/wiki/Hello_Kitty",
                            "last_edited": "4 October 2024",
                            "document_name": "Hello Kitty",
                            "highlighted_text": "Hello Kitty (Japanese: ハロー・キティ, Hepburn: Harō Kiti),[6] also known by her real name Kitty White (キティ・ホワイト, Kiti Howaito),[5] is a fictional character created by Yuko Shimizu",
                            "page_no": "1",
                        }
                    ],
                }
            ],
        }

Outstanding

  • We need to modify the way how we calculate input/output token as now the last LLM returns markdown_answer and citations.

  • Update the format_documents()

Guidance to review

Pay attention to build_llm_chain() function and RequestMetadata

Relevant links

Things to check

  • I have added any new ENV vars in all deployed environments
  • I have tested any code added or changed
  • I have run integration tests

@saisakul saisakul changed the title state now include citations RedboxState now include citations Oct 22, 2024
@saisakul saisakul changed the title RedboxState now include citations RedboxState now includes citations Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants